home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir31 / sds_doc.zip / SMPLDP.TXT < prev   
Text File  |  1993-02-25  |  7KB  |  175 lines

  1.  
  2. SAMPLE DUMP STANDARD
  3.  
  4.     A standard has been developed for sampler data dumps.  It has been
  5. designed to work as an open or closed loop system.  The closed loop
  6. system implements handshaking to improve speed and error recovery. 
  7. This also accomodates machines that may need more time to process
  8. incoming data.  The open loop system may be desired by those wishing
  9. to implement a simplified version with no handshaking.
  10.  
  11.     The basic messages are Dump Request, ACK, NAK, Wait, Cancel, Dump
  12. Header, and Data Packets.  These messages are described in detail
  13. below.  The data formats are given in hexidecimal.
  14.  
  15. Dump Request
  16.  
  17. F0 7E cc 03 ss ss F7    
  18.  
  19. cc     = channel number
  20. ss ss = requested sample, LSB first
  21.  
  22.     Upon receiving this message, the sampler should check to see if the
  23. requested sample number falls in a legal range.  If it is, the sample
  24. is dumped to the requesting master following the procedure outlined
  25. below.  If it is not within a legal range, the message should be
  26. ignored.
  27.  
  28. ACK
  29.  
  30. F0 7E cc 7F pp F7    
  31.  
  32. cc     = channel number
  33. pp     = packet number
  34.  
  35.     This is the first handshaking flag.  It means "Last data packet was
  36. received correctly.  Start sending the next one."  The packet number
  37. represents the packet being acknowledged as correct.
  38. NAK
  39.  
  40. F0 7E cc 7E pp F7    
  41.  
  42. cc     = channel number
  43. pp     = packet number
  44.  
  45.     This is the second handshaking flag.  It means "Last data packet was
  46. received incorrectly.  Please resend."  The packet number represents
  47. the packet being rejected.
  48.  
  49. Cancel
  50.  
  51. F0 7E cc 7D pp F7    
  52.  
  53. cc     = channel number
  54. pp     = packet number
  55.  
  56.     This is the third handshaking flag.  It means "Abort dump."  The
  57. packet number represents the packet on which the abort takes place.
  58.  
  59. Wait
  60.  
  61. F0 7E cc 7C pp F7    
  62.  
  63. cc     = channel number
  64. pp     = packet number
  65.  
  66.     This is the fourth handshaking flag.  It means "Do not send any more
  67. packets until told to do otherwise."  This is important for systems in
  68. which the receiver (such as a computer) may need to perform other
  69. operations (such as disk access) before receiving the remainder of the
  70. dump.  An ACK will continue the dump while a Cancel will abort the
  71. dump.
  72.  
  73. Dump Header
  74.  
  75. F0 7E cc 01 ss ss ee ff ff ff gg gg gg hh hh hh ii ii ii jj F7
  76.  
  77. cc        = channel number
  78. ss ss        = sample number (LSB first)
  79. ee        = sample format (# of significant bits from 8-28)
  80. ff ff ff    = sample period (1/sample rate) in nanoseconds (LSB           
  81. first)
  82. gg gg gg    = sample length in words (LSB first)
  83. hh hh hh    = sustain loop start point word number (LSB first)
  84. ii ii ii    = sustain loop end point word number (LSB first)
  85. jj        = loop type (00 = forward only, 01 = backward/forward)
  86.  
  87. Data Packet
  88.  
  89. F0 7E cc 02 kk <120 bytes> ll F7
  90.  
  91. cc     = channel number
  92. kk     = running packet count (0-127)
  93. ll      = checksum (XOR of 7E cc 02 kk <120 bytes>)
  94.  
  95.     The total size of a data packet is 127 bytes.  This is to prevent
  96. MIDI input buffer overflow in machines that may want to receive an
  97. entire message before processing it.  128 bytes, or 1/2 page of
  98. memory, is considered the smallest reasonable buffer for modern MIDI
  99. instruments.
  100.  
  101.     Once a dump has been requested either from the front panel or over
  102. MIDI, the dump header is sent.  After sending the header, the master
  103. must time out for at least two seconds, allowing the receiver to
  104. decide if it will accept the dump (enough memory, etc.).  If the
  105. master receives a Cancel, it should abort the dump immediately.  If it
  106. receives an ACK, it will start sending data packets.  If it receives a
  107. Wait, it will pause indefinitely until another message is received. 
  108. If nothing is received within the timeout, the master will assume an
  109. open loop and begin sending packets.
  110.  
  111.     A data packet consists of it's own header, a packet number, 120 data
  112. bytes, a checksum, and an End Of Exclusive (EOX).  The packet number
  113. starts at 00 and increments with each new packet, resetting to 00
  114. after it reaches 7FH.  This is used by the receiver to distinguish
  115. between a new data packet and one being resent.  This number is
  116. followed by 120 bytes of data which form 30, 40, or 60 words (MSB
  117. first) depending on the sample format.
  118.  
  119.     Each data byte consists of 7 bits.  If the sample format is 8-14 bit,
  120. two bytes form a word.  Sample formats of 15-21 bits require three
  121. bytes/word (yielding 40 words/packet).  Sample formats of 22-28 bits
  122. require four bytes/word (yielding 30 words/packet).  Information is
  123. left-justified within the 7-bit bytes and unused bits are filled in
  124. with zeros.  For example, the sample word FFFH would be sent as
  125. 01111111B  01111100B.  The word FFFH happens to represent a full
  126. positive value (000H represents full negative).  The checksum is the
  127. XOR of 7E <channel> 02 <packet number> <120 bytes>.
  128.  
  129.     When a sampler is receiving a data dump, it should keep a running
  130. checksum during reception.  If the checksums match, it sends an ACK
  131. and wait for the next packet.  If the checksums do not match, it sends
  132. a NAK and waits for the next packet.  If the next packet number does
  133. not match the previous one and the sampler has no facility for
  134. receiving packets out of sequence, it should ignore the error and
  135. continue as if the checksum had matched.
  136.     
  137.     When a sampler is sending a data dump, it should send a packet and
  138. watch its MIDI In port.  If an ACK is received, it sends the next
  139. packet.  If a NAK is received and the packet number matches that of
  140. the previous packet, it resends that packet.  If the packet numbers do
  141. not match and the sampler has no facility to send packets out of
  142. sequence, it should ignore the NAK.  If a Wait is received, the
  143. sampler should watch its MIDI IN port indefinitely for another message
  144. and process it like a normal ACK, NAK, Cancel, or illegal message
  145. (which would usually abort the dump).  If nothing is received within
  146. 20 milliseconds, the sampler can assume an open loop and send the next
  147. packet.
  148.  
  149.     The packet numbers are included in the handshaking flags (ACK, NAK,
  150. Cancel, Wait) in order to accomodate future machines that might have
  151. the intelligence to retransmit specific packets after the entire dump
  152. is completed or if synchronization is lost.
  153.  
  154.     This process continues until there are less than 121 bytes to send. 
  155. The final data packet will still consist of 120 data bytes regardless
  156. of how many significant bytes actually remain.  The unused bytes will
  157. be filled out with zeros.  The receiver should receive and handshake
  158. on the last packet.  If the receiver's memory becomes full, it should
  159. send a Cancel to the master.
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.     Sample Dump Standard
  171. 1
  172.  
  173.  
  174.  
  175.